package com.mall.admin.interfaces;

import java.lang.reflect.Method;

/**
 * @description 解析权限注解
 * @author Riskre
 */
public class AnnotationParse {
    /**
     * @return 返回注解的authorities值
     * @throws Exception
     * 在需要验证的方法上添加自定义注解: @Permission
     */
    public static String privilegeParse(Method method) throws Exception {
        //获取该方法
        if(method.isAnnotationPresent(Permission.class)){
            Permission annotation = method.getAnnotation(Permission.class);
            return annotation.authorities();
        }
        return null;
    }
}
